
<template>
  <div>

    <el-row type="flex" class="row-bg">

      <el-col :span="10" :offset="1">
      </el-col>
    </el-row>

    <div class="space20">
    </div>

    <el-form :model="item" label-width="140px" ref="item" :inline="true" class="demo-ruleForm" :key="item.IO_ITEM_ID" v-for="(item,index) in producename">

      <el-form-item label="单次自付额内" :prop="'IO_ITEM_ZFEN'" :rules="{
        required: true, message: '单次自付额内', trigger: 'blur'
      }">
        <el-input v-model="item.IO_ITEM_ZFEN"></el-input>
      </el-form-item>
      <el-form-item label="单次自付额外" :prop="'IO_ITEM_ZFEW'" :rules="{
        required: true, message: '单次自付额外不能为空', trigger: 'blur'
      }">
        <el-input v-model="item.IO_ITEM_ZFEW"></el-input>
      </el-form-item>
    
      <el-form-item label="单项给付比例内" :prop="'IO_ITEM_ZFBLN'" :rules="{
        required: true, message: '单项给付比例内不能为空', trigger: 'blur'
      }">
        <el-input v-model="item.IO_ITEM_ZFBLN"></el-input>
      </el-form-item>
      <el-form-item label="单项给付比例外"  :prop="'IO_ITEM_ZFBLW'" :rules="{
        required: true, message: '单项给付比例外不能为空', trigger: 'blur'
      }">
        <el-input v-model="item.IO_ITEM_ZFBLW"></el-input>
      </el-form-item>

      <el-form-item label="单项给付限额余额内" v-if="item.DUTYITEM_ID=='201705110923238635' || item.DUTYITEM_ID=='201705110926265811' || item.DUTYITEM_ID=='201705110926337822'  || item.DUTYITEM_ID=='201705110926472492'" :prop="'IO_ITEM_MAXM'"  :rules="{
        required: true, message: '单项给付限额余额内不能为空', trigger: 'blur'
      }">
        <el-input v-model="item.IO_ITEM_MAXM"></el-input>
      </el-form-item>
      <el-form-item label="单项给付限额余额外" v-if="item.DUTYITEM_ID=='201705110923238635' || item.DUTYITEM_ID=='201705110926265811' || item.DUTYITEM_ID=='201705110926337822'  || item.DUTYITEM_ID=='201705110926472492'">
        <el-input v-model="item.IO_ITEM_MAXMW"></el-input>
      </el-form-item>
       <el-form-item label="给付限额" :prop="'IO_ITEM_MAXM'" v-if="item.DUTYITEM_ID!='201705110923238635' && item.DUTYITEM_ID!='201705110926265811' && item.DUTYITEM_ID!='201705110926337822'  && item.DUTYITEM_ID!='201705110926472492'" :rules="{
        required: true, message: '单项给付限额余额不能为空', trigger: 'blur'
      }">
        <el-input v-model="item.IO_ITEM_MAXM"></el-input>
      </el-form-item>
        
      </el-form-item>
      <el-form-item label="是否为日限额" :prop="'IO_ITEM_ISPER'" :rules="{
        required: true, message: '是否为日限额不能为空', trigger: 'blur'
      }">
        <el-radio-group v-model="item.IO_ITEM_ISPER">
          <el-radio label="是"></el-radio>
          <el-radio label="否"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="单项给付期限" :prop="'IO_ITEM_MAXDAY'">
        <el-input v-model="item.IO_ITEM_MAXDAY"></el-input>
      </el-form-item>
      <el-form-item label="单项保险责任" :prop="'DUTYITEM_ID'" :rules="{
        required: true, message: '单项保险责任不能为空', trigger: 'blur'
      }">
        <el-select v-model="item.DUTYITEM_ID" placeholder="请选择">
          <el-option v-for="item in dutyname" :key="item.DUTYITEM_ID" :label="item.DUTYITEM_NAME" :value="item.DUTYITEM_ID">
          </el-option>
        </el-select>
      </el-form-item>

    </el-form>

  </div>
</template>
<script>
import {
  mapState
} from 'vuex';

import getid from '@/js/getid';
export default {
  props: {
    index: {
      type: Number,
      default: 0
    },
    id: {
      type: String,
      default: 0
    },

  },
  data() {
    return {
      producename: [],
      dutyname: []
    };
  },
  computed: mapState({
    produce: state => state.produce.produce
  }),


  created() {
    this.producename = this.produce[this.index].IO_ITEM;
    this.$http.get("DutyItem/1?fid=" + this.id).then(response => {
      var data = response.body;

      this.dutyname = data;
    
    }, response => {
      this.$notify.error({
        title: '网络错误',
        message: '网络错误'
      });
      this.loding = false;
    });
  }

}
</script>